package com.huawei.gamebox.service.common.cardkit.bean;

import android.text.TextUtils;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import com.huawei.hms.framework.common.ContainerUtils;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import o.Logger;
import o.dob;
import o.dof;

public class BaseGsCardBean extends BaseCardBean {
    private static final String END_FLAG = "_";
    private static final String TAG = "BaseGsCardBean";
    private String gSource_;
    private d listPageBtnInfo;

    public static class d {
        private int ˋ = -1;
        private int ˎ = -1;
        private String ˏ;
        private boolean ॱ = false;

        public boolean ॱ() {
            return this.ॱ;
        }

        public void ˋ(boolean z) {
            this.ॱ = z;
        }

        public int ˋ() {
            return this.ˋ;
        }

        public void ˋ(int i) {
            this.ˋ = i;
        }

        public int ˏ() {
            return this.ˎ;
        }

        public String ˎ() {
            return this.ˏ;
        }
    }

    public String ʽ() {
        return this.gSource_;
    }

    public d ˏॱ() {
        return this.listPageBtnInfo;
    }

    public String u_() {
        return TextUtils.isEmpty(super.u_()) ? ـॱ() : super.u_();
    }

    public boolean ˋ(int i) {
        return false;
    }

    public String ˋ() {
        Map ˊॱ = ˊॱ();
        String[] strArr = new String[ˊॱ.size()];
        ˊॱ.keySet().toArray(strArr);
        Arrays.sort(strArr);
        StringBuilder stringBuilder = new StringBuilder();
        String str = null;
        int i = 0;
        while (true) {
            String ˋ;
            try {
                ˋ = ˋ((Field) ˊॱ.get(strArr[i]));
            } catch (Throwable e) {
                Logger.ˋ(TAG, "getCardId, IllegalAccessException: ", e);
                ˋ = str;
            }
            if (ˋ != null) {
                ˋ = dof.ˏ(ˋ);
                stringBuilder.append(strArr[i]).append(ContainerUtils.KEY_VALUE_DELIMITER).append(ˋ).append(ContainerUtils.FIELD_DELIMITER);
            }
            i++;
            if (i >= strArr.length) {
                return stringBuilder.toString();
            }
            str = ˋ;
        }
    }

    protected Map<String, Field> ˊॱ() {
        Map<String, Field> hashMap = new HashMap();
        for (Field field : dob.ˊ(getClass())) {
            field.setAccessible(true);
            String name = field.getName();
            if (name.endsWith("_")) {
                hashMap.put(name.substring(0, name.length() - "_".length()), field);
            }
        }
        return hashMap;
    }

    private String ˋ(Field field) throws IllegalAccessException {
        Object obj = field.get(this);
        if (obj instanceof JsonBean) {
            return ((JsonBean) obj).toJson();
        }
        if (obj != null) {
            return String.valueOf(obj);
        }
        return null;
    }
}
